package com.neuedu.web;

import com.neuedu.pojo.AdminTable;
import com.neuedu.pojo.CadreTable;
import com.neuedu.pojo.ClueTable;
import com.neuedu.pojo.Result;
import com.neuedu.service.ClueTableService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/CityCounty")
@Tag(name="市县干部管理线索")
public class CityCountyController {
    @Resource
    private ClueTableService clueTableService;
    @PostMapping("/addClueTable")
    public Result<Void> addClueTable(@RequestBody ClueTable clueTable) {
        return this.clueTableService.addClueTable(clueTable);
    }
//查所有的线索
    @GetMapping("/getClueTables")
    public Result<List<ClueTable>> getClueTables(
            @RequestParam(name = "currentPage",defaultValue = "1")Integer currentPage,
            @RequestParam(name = "pageSize",defaultValue = "10")Integer pageSize,
            @RequestParam(name = "responsibleCadreid",defaultValue = "")Integer responsibleCadreid) {
        return this.clueTableService.getClueTables(currentPage,pageSize,responsibleCadreid);
    }
    @DeleteMapping("/deleteClueTable/{id}")
    public Result<Void> deleteClueTable(@PathVariable("id") Integer id) {
        return this.clueTableService.deleteClueTable(id);
    }
    @PutMapping("/update-clue")
    public Result<Void> updateClueTable(@RequestBody ClueTable clueTable) {
        return this.clueTableService.updateClueTable(clueTable);
    }
    @PutMapping("/assign-clue")
    public Result<Void> assignClueTable(@RequestParam(name = "clueId")Integer clueId,
                                        @RequestParam(name = "cadreId")Integer cadreId) {
        return this.clueTableService.assignClueTable(clueId,cadreId);
    }

}
